<script setup>
    import { computed } from 'vue';
    import OrderCard from '@/components/order/OrderCard.vue'

    //获取订单数据库
    import useOrderStore from '@/stores/order';
    const orderStore = useOrderStore()

    //获取订单数据库内的每个购物车商品数据
    const currentUserOrderList = computed(()=>{
        return orderStore.orderList.filter(item => item.user === 'zhangsan')
    }) 

</script>

<template>
        <div class="order_list">
        <div class="order_list_header">我的订单</div>
        <div class="order_list_content">
            <div class="order_list_content_item" v-for="(item, index) in currentUserOrderList" :key="index">
                <OrderCard :item="item" />
            </div>
        </div>
    </div>
</template>

<style lang="scss" scoped>
@import "@/style/viriables.scss";
.order_list {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: .5rem;
    background-color: $dark-bgColor;
    overflow-y: scroll;

    &_header {
        padding: .08rem .18rem;
        font-size: .16rem;
        color: $content-fontcolor;
        text-align: center;
        line-height: .24rem;
        background-color: $bgColor;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }

    &_content {
        margin-top: .58rem;
    }
}
</style>